1. Field of the Invention
This invention relates to modeling of object-oriented database structures, translation to relational database structures, and dynamic searches thereon.
2. Description of Related Art
In the design of computer software systems, it is considered superior to associate each data item with a data type, and to present a relatively uniform interface to objects of each data type to all elements of the system. This technique allows elements of the system to rely on the characteristics of the data type, of the uniform interface to that data type, and of the relationships between that data type and other data types. In addition to so-called xe2x80x9cbuilt inxe2x80x9d data types, such as integers and floating point numbers, it is also superior to extend this technique to more complex data types, sometimes called xe2x80x9cclasses,xe2x80x9d including classes defined by a user of the system. (For example, a user might define a class called telephone number and thus allow elements of the system to store, manipulate, or retrieve telephone numbers as if they were fundamental pieces of information.) Techniques of defining classes of software objects and restricting access to those objects are now common with some programming languages, such as the C++ and Smalltalk programming languages, called object-oriented programming languages (xe2x80x9cOOPLxe2x80x9d).
Recently it has been found that the technique of defining classes of software objects and manipulating those objects has been useful for database applications as well. In object-oriented database (xe2x80x9cOODBxe2x80x9d) applications, a user defines classes of objects, properties of those classes, and relationships between those classes, and populates a database with data items which are instances of those objects. (For example, the class telephone number might be used to store telephone numbers for persons, companies, and computer networks.) It has been found that object-oriented database management presents the advantages of rapid application and database development and of relative software reliability.
However, one problem which has arisen in the art is that many database systems have been designed to operate with another, different database technique, known as xe2x80x9crelational databasexe2x80x9d management (RDBM). In a relational database, the database comprises a set of data tables which represent the relationships between data items. Each table comprises a set of records, one record for each data item; each record comprises a set of columns or fields, one column for each data value associated with the data item. (For example, each record in a table of persons might have a column defined for that person""s telephone number; similarly, each record in a table of companies might have a column defined for that company""s telephone number.) Relational databases have been found to be successful and efficient in managing large databases. Due to their success, there is a substantial investment in relational database management systems, and in applications and computer programs which support or interface to relational database management systems.
It would be advantageous to obtain the advantages of object-oriented database management, while retaining the efficiency of, and the installed investment in, relational database management systems.
One problem which has arisen in the art is that the tools for creating, implementing, and manipulating object-oriented databases are generally inconsistent with the tools for creating, implementing, and manipulating relational databases.
U.S. Pat. No. 5,291,583, xe2x80x9cAutomatic Storage of Persistent ASN.1 Objects in a Relational Schemaxe2x80x9d, issued Mar. 1, 1994, in the name of inventor Subodh Bapat, and, assigned to Racal-Datacom, Inc., and U.S. Pat. No. 5,295,256, xe2x80x9cAutomatic Storage of Persistent Objects in a Relational Schemaxe2x80x9d, issued Mar. 15, 1994, also in the name of inventor Subodh Bapat, and also assigned to Racal-Datacom, Inc., show a method for compiling structures defined using an object-oriented programming language, such as C++ or Smalltalk, into a relational database structure. However, while the method shown in these patents generally achieves the goal of creating a relational database structure for persistent storage of objects, it is generally inadequate to the other tasks demanded of a database application, including dynamically modifying the object hierarchy and object relationships, populating the database, dynamically populating and editing the objects in the database, and dynamically generating and performing searches against the database.
The following patents are examples of the art:
U.S. Pat. No. 5,398,336, xe2x80x9cObject-Oriented Architecture for Factory Floor Managementxe2x80x9d, issued Mar. 14, 1995, in the name of inventors Subhash B. Tantry, et al., and assigned to Consilium, Inc.
U.S. Pat. No. 5,212,787, xe2x80x9cMethod and Apparatus for Accessing A Relational Database Without Exiting An Object-Oriented Environmentxe2x80x9d, issued May 18, 1993, in the name of inventors Ronald B. Baker, et al., and assigned to International Business Machines Corporation.
U.S. Pat. No. 5,201,046, xe2x80x9cRelational Database Management System and Method for Storing, Retrieving and Modifying Directed Graph Data Structuresxe2x80x9d, issued Apr. 6, 1993, in the name of inventors Robert N. Goldberg, et al., and assigned to Xidak, Inc.
U.S. Pat. No. 5,181,162, xe2x80x9cDocument Management and Production Systemxe2x80x9d, issued Jan. 19, 1993, in the name of inventors Robert M. Smith, et al., and assigned to Eastman Kodak Company.
U.S. Pat. No. 5,161,225, xe2x80x9cPersistent Stream for Processing Time Consuming and Reusable Queries in An Object Oriented Database Management Systemxe2x80x9d, issued Nov. 3, 1992, in the name of inventors Robert L. Abraham, et al., and assigned to International Business Machines Corporation.
U.S. Pat. No. 5,133,075, xe2x80x9cMethod of Monitoring Changes in Attribute Values of Objects in An Object-Oriented Databasexe2x80x9d, issued Jul. 21, 1992, in the name of inventor Tore J. M. Risch, and assigned to Hewlett-Packard Company.
U.S. Pat. No. 4,930,071, xe2x80x9cMethod for Integrating A Knowledge-Based System with An Arbitrary Database Systemxe2x80x9d, issued May 29, 1990, in the name of inventors Frederich N. Tou, et al., and assigned to IntelliCorp, Inc.
Accordingly, it would be advantageous to provide a method of compilation and translation between object-oriented and relational database structures which obtains the advantages of object-oriented database applications, while retaining the ability to use present relational database management systems.
The invention provides a method and system for modeling of object-oriented database structures, translation to relational database structures, and dynamic searches thereon. The invention thus allows a user to create, edit and manipulate a user""s object database (which the method and system dynamically translates into a set of relational database structures), to create, edit and manipulate objects for that object database (which the method and system dynamically translates into data for those relational database structures), and to create, edit and manipulate queries to be applied to that object database (which the method and system dynamically translates into queries to be applied to those relational database structures).
The method and system includes a meta-model of the user""s object database, which is itself an object database, and which has itself been translated into a set of relational database structures for manipulation by a relational database engine. The meta-model comprises a set of classes, objects, and relationships between classes which model the classes and relationships between classes of the system. Each of these classes may comprise a set of searchable properties, and each of these relationships may comprise an inheritance relationship (between a base class and a derived class) or a data-model relationship (such as a one-to-one, one-to-many, or many-to-many relationship). The data model of the user""s object database is modeled by actual objects in the meta-model, and editing or manipulating the user""s object database is modeled by creating, modifying, or deleting objects in the meta-model. The meta-model also models itself, in the same manner as it models the user""s object database, and may be manipulated in the same manner as the user""s object database.
In a preferred embodiment, each class in the user""s object database is modeled by a relational database table, each searchable property of that class is modeled by a column in that table, and each object of that class is modeled by a row in that table and corresponding rows in tables representing base classes for that object. Each such table comprises an xe2x80x9cobject-IDxe2x80x9d column generated by the system, comprising a unique ID for each object in the system. Each relationship between two objects is modeled by providing a pointer from the first object to the second object; the pointer comprises a column (generated by the system to model the relationship) in the first object""s table with the object-ID of the second object. These relational database structures are created, modified, or deleted dynamically or incrementally in response to user commands to create, edit, and manipulate the user""s object database.
At least two types of relationship are modeled by the system, inheritance relationships and data-model relationships. An inheritance relationship exists between a base class and a derived class. An object member of the derived class is entered in both the table for the base class and the table for the derived class, and it is given the same object-ID in both tables. The inheritance relationship between the two classes is modeled by a relational database JOIN between the two tables on the xe2x80x9cobject-IDxe2x80x9d column. For multiple inheritance, an object with the same object-ID is entered in the derived class and in each of the multiple base classes.
A data-model relationship is created by the user for the user""s object database, and may comprise a one-to-one, many-to-one, or many-to-many relationship. One-to-one and many-to-one relationships are modeled by providing a pointer from the first object to the second object. Many-to-many relationships are modeled by providing a cross-link class, implemented using a table having one column for the first class having the object-ID of the first object in the many-to-many relationship, one column for the second class having the object-ID of the second object in the many-to-many relationship, and having one row for each pair of actually related objects. One-to-one and many-to-one relationships are modeled by a relational database JOIN between the two corresponding tables on the column modeling the data-model relationship; many-to-many relationships are modeled by a relational database JOIN between the two corresponding tables and the cross-link table, on the two columns modeling the data-model relationship.
The method and system includes a query model which provides for querying the user""s object database with a search that may be cascaded across multiple classes of objects. The user selects one or more classes to be searched, restrictions on searchable properties of objects in those classes (such as having specific values for those searchable properties), and information to be presented for objects in those classes. In response to this search description, the system generates a relational database query (preferably comprising an optimized SQL command) to be applied to the relational database structures corresponding to the user""s object database, automatically including any commands needed to implement the inheritance relationships and data-model relationships of the user""s object database. A preferred embodiment provides for automatic unit conversion of searchable properties"" values. When the relational database query is applied to the relational database, the system receives information supplied from the relational database and presents it to the user according to display properties of the classes which were searched.
In a preferred embodiment, the meta-model comprises a first set of predefined classes for modeling access control to aspects of the user""s object database. Access may be restricted to selected users or to selected user groups, and may be specified for individual objects, classes of objects, or properties of those objects. In a preferred embodiment, the meta-model also comprises a second set of predefined classes for modeling attachment of graphic and text objects to objects in the user""s object database. Graphic and text objects may be associated with objects in the user""s object database, and may be associated with system files and other objects maintained by an operating system in which the meta-model is embedded.